Title Banner

Previous Book Contents Book Index Next

Inside Macintosh: QuickDraw GX Printing /
Chapter 2 - Core Printing Features / Using Core Printing Features


Obtaining Object References

A job object can reference several format objects. Once you know which format object you want, you can access its properties. QuickDraw GX provides the GXGetFormatJob function to determine which job object is associated with a particular format object. Even if you know the format's job, you may still want to examine all references to the job's format objects. You can obtain these references with the GXGetJobFormat function.

Listing 2-12 shows an example that uses the GXGetFormatJob function to obtain the job object that references a format object and then loops through all the job's format objects using the GXGetJobFormat function. The example's function, MyGetFormatIndex, returns the format's position, or index value, of the specified format object in the job's list of format objects.

Listing 2-12 Using the GXGetFormatJob function to obtain a job object

long MyGetFormatIndex(gxFormat myFormat)
{
   gxJob    formatsJob;
   long     idx, numFormats;

/* 
   Obtain the job object and count of the number of format objects 
   it references.
*/
   formatsJob = GXGetFormatJob(myFormat);
   numFormats = GXCountJobFormats(formatsJob);

/* 
   Compare each of the references to locate the specified format 
   object and return the current format object index.
*/
   for (idx = 1; idx <= numFormats; ++idx)
      if (myFormat == GXGetJobFormat(formatsJob, idx))
         return idx;
}

Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996




Navigation graphic, see text links

Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help